package com.chanta.server.persistence;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

/**
 * TODO Please comment this class..
 * 
 * @author Hakan Özdemir - Vendoo Inc.
 * @date 02.11.2013
 * 
 */
@PersistenceCapable
public class Portal {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	/** do not rename */
	@Persistent
	private User owner;

	@Persistent(mappedBy = "portal")
	private List<Field> fields;

	@Persistent(mappedBy = "portal")
	private List<Template> templates;

	@Persistent(mappedBy = "portal")
	private List<Rule> rules;

	@Persistent(mappedBy = "portal")
	private List<Library> libraries;

	@Persistent
	private String portalname;

	@Persistent
	private Date creationDate;

	@Persistent
	private Integer version;

	/**
	 * Getter for owner.
	 * 
	 * @return owner
	 */
	public User getOwner() {
		return owner;
	}

	/**
	 * Setter for owner.
	 * 
	 * @param owner
	 *            the owner to set
	 */
	public void setOwner(User owner) {
		this.owner = owner;
	}

	/**
	 * Getter for fields.
	 * 
	 * @return fields
	 */
	public List<Field> getFields() {
		return fields;
	}

	/**
	 * Setter for fields.
	 * 
	 * @param fields
	 *            the fields to set
	 */
	public void setFields(List<Field> fields) {
		this.fields = fields;
	}

	/**
	 * Getter for templates.
	 * 
	 * @return templates
	 */
	public List<Template> getTemplates() {
		return templates;
	}

	/**
	 * Setter for templates.
	 * 
	 * @param templates
	 *            the templates to set
	 */
	public void setTemplates(List<Template> templates) {
		this.templates = templates;
	}

	/**
	 * Getter for rules.
	 * 
	 * @return rules
	 */
	public List<Rule> getRules() {
		return rules;
	}

	/**
	 * Setter for rules.
	 * 
	 * @param rules
	 *            the rules to set
	 */
	public void setRules(List<Rule> rules) {
		this.rules = rules;
	}

	/**
	 * Getter for libraries.
	 * 
	 * @return libraries
	 */
	public List<Library> getLibraries() {
		return libraries;
	}

	/**
	 * Setter for libraries.
	 * 
	 * @param libraries
	 *            the libraries to set
	 */
	public void setLibraries(List<Library> libraries) {
		this.libraries = libraries;
	}

	/**
	 * Getter for portalname.
	 * 
	 * @return portalname
	 */
	public String getPortalname() {
		return portalname;
	}

	/**
	 * Setter for portalname.
	 * 
	 * @param portalname
	 *            the portalname to set
	 */
	public void setPortalname(String portalname) {
		this.portalname = portalname;
	}

	/**
	 * Getter for creationDate.
	 * 
	 * @return creationDate
	 */
	public Date getCreationDate() {
		return creationDate;
	}

	/**
	 * Setter for creationDate.
	 * 
	 * @param creationDate
	 *            the creationDate to set
	 */
	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	/**
	 * Getter for version.
	 * 
	 * @return version
	 */
	public Integer getVersion() {
		return version;
	}

	/**
	 * Setter for version.
	 * 
	 * @param version
	 *            the version to set
	 */
	public void setVersion(Integer version) {
		this.version = version;
	}
}
